<template>
	<div class="mainWrapper Adjustment">
		<el-breadcrumb separator="/">
			<el-breadcrumb-item :to="{ path: '/' }">
				<i class="lh lh-caiwu fw_100"></i>
			</el-breadcrumb-item>
			<el-breadcrumb-item>账单结算</el-breadcrumb-item>
			<el-breadcrumb-item>任务调账明细</el-breadcrumb-item>
		</el-breadcrumb>

		<div class="content_Box box-shadow">
			<div class="py_5 px_10">
				<el-row>
					<el-col :span="4">
						<el-button type="default" class="fl" @click="downloadOrder()" round size="mini">导出</el-button>
					</el-col>
					<el-col :span="20" class="fr">
						<el-form :inline="true" class="form-inline fr" @keyup.enter.native="shearchBtn()">
							<el-form-item>
								<el-input v-model="adjustment_sn" placeholder="调账记录编号"></el-input>
							</el-form-item>
							<el-form-item>
								<el-input v-model="task_sn" placeholder="任务编号"></el-input>
							</el-form-item>
							<el-form-item>
								<el-input v-model="bill_sn" placeholder="结算单编号"></el-input>
							</el-form-item>
							<lh-agent-list @sendValue="setValue" :reset="agent_reset"></lh-agent-list>
							<el-form-item>
								<el-select class="w_110" v-model="city_val" placeholder="请选择城市" @change="changeCity">
									<el-option
										v-for="item in cityList"
										:key="item.id"
										:label="item.name"
										:value="`${item.id}|${item.name}`"
									></el-option>
								</el-select>
							</el-form-item>
							<el-form-item>
								<el-select v-model="s_area_arr" multiple collapse-tags placeholder="商圈">
									<el-button
										size="mini"
										type="primary"
										class="round-right all-area"
										@click="selectAllArea()"
										native-type="button"
										>{{ areaStatus ? '全选' : '取消全选' }}</el-button
									>
									<el-option
										v-for="item in areaList"
										:key="item.id"
										:label="item.area_name"
										:value="`${item.id}|${item.area_name}`"
									></el-option>
								</el-select>
							</el-form-item>
							<el-form-item>
								<el-autocomplete
									size="mini"
									class="w_150"
									v-model="shop_name"
									:fetch-suggestions="querySearch"
									placeholder="请选择店铺名称"
									:trigger-on-focus="true"
									@select="handleSelect"
									clearable
								></el-autocomplete>
							</el-form-item>
							<el-form-item>
								<el-autocomplete
									size="mini"
									class="w_130"
									v-model="s_personnel_name"
									:fetch-suggestions="querySearchStaff"
									placeholder="接单人"
									:trigger-on-focus="true"
									@select="handleSelectStaff"
									clearable
								></el-autocomplete>
							</el-form-item>
							<el-form-item class="w_90">
								<el-select v-model="adjust_type" placeholder="调账对象" clearable>
									<el-option label="调账对象" value=""></el-option>
									<el-option label="店铺" value="shop"></el-option>
									<el-option label="人才" value="staff"></el-option>
								</el-select>
							</el-form-item>
							<el-form-item class="w_90">
								<el-select v-model="reconciliation_type" placeholder="调账类型" clearable>
									<el-option label="平台调账" value="1"></el-option>
								</el-select>
							</el-form-item>

							<el-form-item class="w_90">
								<el-select v-model="status" :disabled="statusDisabled" placeholder="状态" clearable>
									<el-option
										v-for="item in statusObj"
										:key="item.value"
										:label="item.label"
										:value="item.value"
									></el-option>
								</el-select>
							</el-form-item>
							<el-form-item prop="datetime1">
								<el-form-item prop="date1">
									<el-date-picker
										class="w_180i"
										v-model="start_time"
										type="datetime"
										value-format="yyyy-MM-dd HH:mm:ss"
										format="yyyy-MM-dd HH:mm:ss"
										default-time="00:00:00"
										placeholder="创建开始时间"
									>
									</el-date-picker>
								</el-form-item> </el-form-item
							>~
							<el-form-item prop="datetime2">
								<el-form-item prop="date2">
									<el-date-picker
										class="w_180i"
										v-model="end_time"
										type="datetime"
										value-format="yyyy-MM-dd HH:mm:ss"
										format="yyyy-MM-dd HH:mm:ss"
										default-time="23:59:59"
										placeholder="创建结束时间"
									>
									</el-date-picker>
								</el-form-item>
							</el-form-item>
							<el-button size="mini" type="primary" class="round-right" native-type="button" @click="shearchBtn"
								>搜索</el-button
							>
							<el-button size="mini" round @click="resetBtn">重置</el-button>
						</el-form>
					</el-col>
				</el-row>
			</div>

			<div class="tableMaxBox">
				<template>
					<!-- 表格部分 -->
					<el-table :data="adjustmentList" stripe>
						<el-table-column type="index" prop="id" label="序号" width="50px" align="center"></el-table-column>
						<el-table-column prop="sn" label="调账记录编号" width="120">
							<template slot-scope="{ row }">
								<span>{{ row.sn }}</span>
							</template>
						</el-table-column>
						<el-table-column prop="task_sn" label="任务编号" width="130">
							<template slot-scope="{ row }">
								<span>{{ row.task_sn }}</span>
							</template>
						</el-table-column>
						<el-table-column prop="shop_name" label="店铺名称" width="200">
							<template slot-scope="{ row }">
								<span>{{ row.shop_name }}</span>
							</template>
						</el-table-column>
						<el-table-column prop="agent_name" label="代理商" width="110"></el-table-column>
						<el-table-column prop="city_name" label="城市" width="110"></el-table-column>
						<el-table-column prop="area_name" label="商圈" min-width="80"></el-table-column>
						<el-table-column prop="task_name" label="任务名称" width="90">
							<template slot-scope="{ row }">
								<span>{{ row.task_name }}</span>
							</template>
						</el-table-column>
						<el-table-column prop="staff_name" label="接单人" width="80">
							<template slot-scope="{ row }">
								<span>{{ row.staff_name }}</span>
							</template>
						</el-table-column>
						<el-table-column prop="staff_mobile" label="手机号" width="120">
							<template slot-scope="{ row }">
								<span>{{ row.staff_mobile }}</span>
							</template>
						</el-table-column>
						<el-table-column prop="hour_actual" label="实际时长" width="70">
							<template slot-scope="{ row }">
								<span>{{ row.hour_actual }}</span>
							</template>
						</el-table-column>
						<el-table-column prop="adjust_type" label="调账类型" align="center">
							<template slot-scope="{ row }">
								<span>{{ row.adjust_mold }}</span>
								<!-- <span class="text-info" v-if="row.adjust_type == 'shop'">店铺</span> -->
							</template>
						</el-table-column>
						<el-table-column prop="adjust_type" label="调账对象" align="center">
							<template slot-scope="{ row }">
								<span class="text-success" v-if="row.adjust_type == 'staff'">人才</span>
								<span class="text-info" v-if="row.adjust_type == 'shop'">店铺</span>
							</template>
						</el-table-column>
						<el-table-column prop="adjust_hours" label="调整时长" width="70">
							<template slot-scope="{ row }">
								<span>{{ row.adjust_hours }}</span>
							</template>
						</el-table-column>
						<el-table-column prop="amount_other" label="其他金额" width="70">
							<template slot-scope="{ row }">
								<span>{{ row.amount_other }}</span>
							</template>
						</el-table-column>
						<el-table-column prop="adjust_amount" label="合计金额" width="70">
							<template slot-scope="{ row }">
								<span>{{ row.adjust_amount }}</span>
							</template>
						</el-table-column>

						<el-table-column prop="remark" label="备注" min-width="160">
							<template slot-scope="{ row }">
								<span>{{ row.remark }}</span>
							</template>
						</el-table-column>
						<!-- <el-table-column prop="pay_status" label="支付状态" min-width="120">
							<template slot-scope="{ row }">
								<span>{{ row.pay_status }}</span>
							</template>
						</el-table-column> -->
						<el-table-column prop="status" label="状态" width="80">
							<template slot-scope="{ row }">
								<span class="text-light" v-if="row.status == 10">已创建</span>
								<span class="text-primary" v-if="row.status == 20">已入结算单</span>
								<span class="text-danger" v-if="row.status == 30">已作废</span>
								<span class="text-info" v-if="row.status == 40 && row.adjust_type == 'shop'">已确认</span>
								<span class="text-success" v-if="row.status == 50 && row.adjust_type == 'shop'">已支付</span>
								<span class="text-danger" v-if="row.status == 60 && row.adjust_type == 'shop'">已退款</span>
								<span class="text-info" v-if="row.status == 40 && row.adjust_type == 'staff'">待付款</span>
								<span class="text-success" v-if="row.status == 50 && row.adjust_type == 'staff'">已付款</span>
							</template>
						</el-table-column>
						<el-table-column prop="bill_sn" label="结算单编号" width="120">
							<template slot-scope="{ row }">
								<span>{{ row.bill_sn }}</span>
							</template>
						</el-table-column>
						<!-- <el-table-column prop="bill_sn" label="支付记录编号" width="120">
							<template slot-scope="{ row }">
								<span>{{ row.bill_sn }}</span>
							</template>
						</el-table-column> -->
						<el-table-column prop="sn" label="支付记录编号" width="200">
							<template slot-scope="{ row }">
								<div class="pointer u text-primary" @click="goToMore(row)">
									<span>{{ row.order_record_sn[0] }}</span>
									<span v-if="row.order_record_sn.length > 1">等{{ row.order_record_sn.length }}个</span>
								</div>
							</template>
						</el-table-column>
						<el-table-column prop="adder" label="创建人" width="80">
							<template slot-scope="{ row }">
								<span>{{ row.adder }}</span>
							</template>
						</el-table-column>
						<el-table-column prop="add_time" label="创建时间" width="160">
							<template slot-scope="{ row }">
								<span>{{ row.add_time }}</span>
							</template>
						</el-table-column>
						<el-table-column label="操作" min-width="280px" fixed="right">
							<template slot-scope="{ row }">
								<el-link
									:underline="false"
									type="info"
									@click="rebegin(row)"
									class="InfoFont text-primary"
									v-if="row.status == '10'"
									>修改</el-link
								>
								<el-link :underline="false" type="success" @click="rebeginsee(row)" class="InfoFont text-primary"
									>查看</el-link
								>
								<el-link
									:underline="false"
									@click="confirmation(row)"
									class="InfoFont text-primary"
									style="color: var(--blue2);"
									v-if="row.status == 10 && row.adjust_type == 'shop' && +row.is_prepay == 1"
									>确认调账</el-link
								>
								<el-link
									:underline="false"
									type="danger"
									class="InfoFont text-primary"
									@click="ZfStop(row)"
									v-if="row.status == '10' || row.status == '20'"
									>作废</el-link
								>
								<el-link :underline="false" class="InfoFont text-primary" @click="goTorecord(row)">操作记录</el-link>
							</template>
						</el-table-column>
					</el-table>
					<!-- 分页组件 -->
					<page :total="total" :pageNums="pageNum" :disableMountedFetch="true" @pagedata="onChildValue"></page>
				</template>
			</div>
		</div>
		<!-- 修改调账记录-弹框 -->
		<el-dialog
			title="修改调账记录"
			:visible.sync="JobStateedit"
			width="940px"
			:close-on-click-modal="false"
			:before-close="hiddenRY"
		>
			<div class="auditCentent">
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key"><i class="lhadmin lhadmin-wujiaoxing"></i>任务编号</div>
						<div class="fl list-cont bb">
							<el-input size="mini" placeholder="请填写" v-model="adjustment.task_sn" disabled></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">店铺名称</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.dpmc"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">商圈</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.sq"></el-input>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">岗位</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.gw"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">工作时间</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.gzsj"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">单价</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.dj"></el-input>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">接单人</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.jdr"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">实际时长</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.sjsc"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">费用</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.fy"></el-input>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">签到时间</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.qdsj"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">完成时间</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.wcsj"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">状态</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.zt"></el-input>
						</div>
					</div>
				</div>
				<el-divider v-if="adjustment.adjust_type == 'shop'">对店铺{{ ' ' + adjustment.dj }}</el-divider>
				<el-divider v-if="adjustment.adjust_type == 'staff'">对人才{{ ' ' + adjustment.personnel_dj }}</el-divider>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">时长</div>
						<div class="fl list-cont shichang">
							<el-select v-model="adjustment.sc">
								<el-option label="加" value="1"></el-option>
								<el-option label="减" value="2"></el-option>
							</el-select>
							<el-input
								size="mini"
								v-model="adjustment.sc_next"
								onKeyPress="if((event.keyCode<48 || event.keyCode>57) && event.keyCode!=46 || /\.\d\d$/.test(value))event.returnValue=false"
							></el-input>
							<div style="margin: 0 22px 0 0;">h</div>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">时长金额</div>
						<div class="fl list-cont shichang_next">
							<el-input size="mini" v-model="adjustment.scje" disabled></el-input>
							<div style="margin: 0 22px 0 0;">元</div>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">其他金额</div>
						<div class="fl list-cont shichang">
							<el-select v-model="adjustment.qtje">
								<el-option label="加" value="1"></el-option>
								<el-option label="减" value="2"></el-option>
							</el-select>
							<el-input size="mini" v-model="adjustment.qtje_next"></el-input>
							<div style="margin: 0 16px 0 0;">元</div>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">合计金额</div>
						<div class="fl list-cont shichang_next">
							<el-input size="mini" v-model="adjustment.hjje" disabled></el-input>
							<div style="margin: 0 22px 0 0;">元</div>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key"><i class="lhadmin lhadmin-wujiaoxing"></i>备注</div>
						<div class="fl list-cont shichang">
							<el-input type="textarea" :rows="8" :cols="44" placeholder="请填写" v-model="adjustment.bz"></el-input>
						</div>
					</div>
				</div>
			</div>
			<div slot="footer" class="dialog-footer">
				<span class="btnOK mr_20" @click="ticketMesauditEdit()">保 存</span>
				<span class="resetBtn" @click="hiddenRY()">关 闭</span>
			</div>
		</el-dialog>
		<!-- 查看调账记录-弹框 -->
		<el-dialog
			title="查看调账记录"
			:visible.sync="JobStatesee"
			width="940px"
			:close-on-click-modal="false"
			:before-close="hiddenRY"
		>
			<div class="auditCentent">
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">调账记录编号</div>
						<div class="fl list-cont bb">
							<el-input size="mini" placeholder="" disabled v-model="adjustment.adjustment_sn"></el-input>
						</div>
					</div>
					<div class="row-info clear" v-if="adjustment.adjust_type == 'shop'">
						<div class="fl title-key">发票状态</div>
						<div class="fl list-cont bb">
							<!-- 未开票，已申请，已开票 -->
							{{ adjustment.invoice_status_name }}
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">任务编号</div>
						<div class="fl list-cont bb">
							<el-input size="mini" placeholder="" disabled v-model="adjustment.task_sn"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">店铺名称</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.dpmc"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">商圈</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.sq"></el-input>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">岗位</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.gw"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">工作时间</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.gzsj"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">单价</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.dj"></el-input>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">接单人</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.jdr"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">实际时长</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.sjsc"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">费用</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.fy"></el-input>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">签到时间</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.qdsj"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">完成时间</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.wcsj"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">状态</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.zt"></el-input>
						</div>
					</div>
				</div>
				<el-divider v-if="adjustment.adjust_type == 'shop'">对店铺{{ ' ' + adjustment.dj }}</el-divider>
				<el-divider v-if="adjustment.adjust_type == 'staff'">对人才{{ ' ' + adjustment.personnel_dj }}</el-divider>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">时长</div>
						<div class="fl list-cont shichang">
							<el-select v-model="adjustment.sc" disabled>
								<el-option label="加" value="1"></el-option>
								<el-option label="减" value="2"></el-option>
							</el-select>
							<el-input size="mini" v-model="adjustment.sc_next" disabled></el-input>
							<div style="margin: 0 22px 0 0;">h</div>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">时长金额</div>
						<div class="fl list-cont shichang_next">
							<el-input size="mini" v-model="adjustment.scje" disabled></el-input>
							<div style="margin: 0 22px 0 0;">元</div>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">其他金额</div>
						<div class="fl list-cont shichang">
							<el-select v-model="adjustment.qtje" disabled>
								<el-option label="加" value="1"></el-option>
								<el-option label="减" value="2"></el-option>
							</el-select>
							<el-input size="mini" v-model="adjustment.qtje_next" disabled></el-input>
							<div style="margin: 0 16px 0 0;">元</div>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">合计金额</div>
						<div class="fl list-cont shichang_next">
							<el-input size="mini" v-model="adjustment.hjje" disabled></el-input>
							<div style="margin: 0 22px 0 0;">元</div>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">备注</div>
						<div class="fl list-cont shichang">
							<el-input type="textarea" :rows="8" :cols="44" placeholder="" v-model="adjustment.bz" disabled></el-input>
						</div>
					</div>
				</div>
			</div>
			<div slot="footer" class="dialog-footer">
				<span class="resetBtn" @click="hiddenRY()">关 闭</span>
			</div>
		</el-dialog>
		<!-- 作废确认 -->
		<el-dialog title="调账作废" :visible.sync="FPShowStop" width="460px" :close-on-click-modal="false">
			<div class="auditCentent">
				<span>确认要作废该条调账记录吗？</span>
			</div>
			<div slot="footer" class="dialog-footer">
				<span class="btnOK mr_20" @click="next()">确 定</span>
				<span class="resetBtn" @click="hiddenRY()">取 消</span>
			</div>
		</el-dialog>
		<!-- 操作记录-弹框 -->
		<el-dialog
			:title="'操作记录：' + top_bill_sn"
			:visible.sync="cordTicket"
			width="600px"
			:close-on-click-modal="false"
		>
			<div class="auditCentent">
				<div class="timeline" v-if="message.add_time != '0000-00-00 00:00:00'">
					<el-button type="success" class="fl" round size="mini">已创建</el-button>
					<span>{{ message.add_time }}</span>
					<span>{{ message.adder }}</span>
				</div>
				<div class="timeline" v-if="message.affirm_time != '0000-00-00 00:00:00'">
					<el-button type="success" class="fl" round size="mini">已确认</el-button>
					<span>{{ message.affirm_time }}</span>
					<span>{{ message.affirm }}</span>
				</div>
				<div class="timeline" v-if="message.settlement_time != '0000-00-00 00:00:00'">
					<el-button type="success" class="fl" round size="mini">已入账单</el-button>
					<span>{{ message.settlement_time }}</span>
					<span>{{ message.settlementer }}</span>
				</div>
				<div class="timeline" v-if="message.payment_time != '0000-00-00 00:00:00'">
					<el-button type="success" class="fl" round size="mini">已支付</el-button>
					<span>{{ message.payment_time }}</span>
					<span>{{ message.paymenter }}</span>
				</div>
				<div class="timeline" v-if="message.invalid_time != '0000-00-00 00:00:00'">
					<el-button type="success" class="fl" round size="mini">已作废</el-button>
					<span>{{ message.invalid_time }}</span>
					<span>{{ message.invalider }}</span>
				</div>
			</div>
			<div slot="footer" class="dialog-footer">
				<span class="resetBtn" @click="hiddenRY()">关 闭</span>
			</div>
		</el-dialog>
		<!-- 该任务已有调账记录，确认还要创建吗? -->
		<el-dialog title="创建提示" :visible.sync="AssignmentTips" width="560px" :close-on-click-modal="false">
			<div class="auditCentent">
				<span>该任务已有调账记录，确认还要创建吗?</span>
			</div>
			<div slot="footer" class="dialog-footer">
				<span class="btnOK mr_20" @click="ticketMesaudit(2)">确 定</span>
				<span class="resetBtn" @click="hiddenRY()">取 消</span>
			</div>
		</el-dialog>
	</div>
</template>

<script>
var common = require('../../../static/tool.js')
import { mainfun } from '../../../assets/js/main.js'
import { publicData } from '../../../assets/js/data.js'
import { fetchAreaList, confirmChange } from '@/api/shop.js'
import { fetchCityList } from '@/api/city.js'
export default {
	name: 'ShopMonitoring',
	data() {
		return {
			windowSizeHeight: document.documentElement.clientHeight, //浏览器可视化窗口的大小
			screenHeight: document.documentElement.clientHeight,
			manageInfo: JSON.parse(sessionStorage.getItem('manageInfo')), //登录信息
			url: common.url,
			head_url: common.head_url,
			sn: '',
			top_bill_sn: '',
			message: '',
			//搜索对应值
			adjustment_sn: '',
			task_sn: '',
			bill_sn: '',
			statusDisabled: true,

			area_arr: '', //商圈信息
			area_id: '',
			area_name: '',
			adjust_type: '', //结算单类型
			reconciliation_type: '',
			status: '', //状态
			shop_id: '', //店铺id
			shop_sn: '', //店铺sn
			shop_name: '', //店铺名
			s_personnel_sn: '',
			s_personnel_name: '',
			start_time: '', //创建开始时间
			end_time: '', //创建结束时间
			cityList: [], //城市列表
			city_arr: '',
			city_id: '',
			city_name: '',

			statusObj: [],

			adjustmentList: [], //调账列表
			renList: [], //人才列表
			//向分页组件传值
			total: 0,
			pageNum: 1,
			pageSizeNow: 20,
			areaList: [], //区域列表
			shopList: [], //店铺列表
			JobStateedit: false,
			JobStatesee: false,
			FPShowStop: false,
			cordTicket: false,
			AssignmentTips: false,

			//创建调账记录的值
			adjustment: {
				adjustment_sn: '', //调账记录编号
				task_sn: '', //任务编号
				dpmc: '', //店铺名称
				sq: '', //商圈
				gw: '', //岗位
				gzsj: '', //工作时间
				dj: '', //单价
				personnel_dj: '',
				jdr: '', //接单人
				sjsc: '', //实际时长
				fy: '', //费用
				qdsj: '', //签到时间
				wcsj: '', //完成时间
				zt: '', //状态
				sc: '1', //时长
				sc_next: '0',
				scje: '0', //时长金额
				qtje: '1', //其他金额
				qtje_next: '0',
				hjje: '0', //合计金额
				bz: '', //备注
				adjust_type: '',
				invoice_status_name: '' //发票状态
			},
			cityList: [], //城市列表
			city_arr: '',
			city_id: '',
			city_name: '',
			city_val: '',
			areaList: [], //区域列表
			s_area_arr: '', //商圈信息
			agent_id: '',
			s_area_id: '',
			s_area_name: '',
			areaStatus: true,
			agent_reset: 0
		}
	},
	computed: {
		//时长金额计算
		scje() {
			if (this.adjustment.adjust_type == 'shop') {
				if (this.adjustment.sc == 1) {
					return (
						Number(this.adjustment.sc_next) *
						Number(this.adjustment.dj.substring(0, this.adjustment.dj.length - 4)) *
						1
					).toFixed(2)
				} else {
					return (
						Number(this.adjustment.sc_next) *
						Number(this.adjustment.dj.substring(0, this.adjustment.dj.length - 4)) *
						(-1).toFixed(2)
					)
				}
			} else {
				if (this.adjustment.sc == 1) {
					return (
						Number(this.adjustment.sc_next) *
						Number(this.adjustment.personnel_dj.substring(0, this.adjustment.personnel_dj.length - 4)) *
						1
					).toFixed(2)
				} else {
					return (
						Number(this.adjustment.sc_next) *
						Number(this.adjustment.personnel_dj.substring(0, this.adjustment.personnel_dj.length - 4)) *
						(-1).toFixed(2)
					)
				}
			}
		},
		//合计金额计算
		hjje() {
			if (this.adjustment.qtje == 1) {
				return (Number(this.adjustment.qtje_next * 1) + Number(this.adjustment.scje) * 1).toFixed(2)
			} else {
				return (Number(this.adjustment.qtje_next * -1) + Number(this.adjustment.scje) * 1).toFixed(2)
			}
		}
		// city_value() {
		// 	return this.city_val
		// }
	},
	watch: {
		scje(newValue, oldValue) {
			if (!isNaN(newValue)) {
				this.adjustment.scje = newValue
			} else {
				this.adjustment.scje = 0
			}
		},
		hjje(newValue, oldValue) {
			if (!isNaN(newValue)) {
				this.adjustment.hjje = newValue
			} else {
				this.adjustment.hjje = 0
			}
		},
		adjust_type(newValue) {
			if (!newValue) {
				this.statusDisabled = true
				this.statusObj = []
			} else if (newValue == 'shop') {
				this.statusDisabled = false
				this.statusObj = [
					{
						value: 10,
						label: '已创建'
					},
					{
						value: 20,
						label: '已入结算单'
					},
					{
						value: 40,
						label: '已确认'
					},
					{
						value: 50,
						label: '已支付'
					},
					{
						value: 60,
						label: '已退款'
					},
					{
						value: 30,
						label: '已作废'
					}
				]
			} else if (newValue == 'staff') {
				this.statusDisabled = false
				this.statusObj = [
					{
						value: 10,
						label: '已创建'
					},
					{
						value: 20,
						label: '已入结算单'
					},
					{
						value: 40,
						label: '待付款'
					},
					{
						value: 50,
						label: '已付款'
					},
					{
						value: 30,
						label: '已作废'
					}
				]
			}
		},
		//商圈改变
		areaList(newValue, oldValue) {
			//上面的列表数据
			this.listShop()
		}
	},
	created() {
		this.start_time = this.$moment().subtract('days', 7).format('YYYY-MM-DD') + ' 00:00:00'
		this.end_time = this.$moment().format('YYYY-MM-DD') + ' 23:59:59'
		if (this.$route.query.task_sn) {
			this.task_sn = this.$route.query.task_sn
		}

		if (this.$route.query.adjustment_sn) {
			this.adjustment_sn = this.$route.query.adjustment_sn
		}
		this.PersonnelList()
	},
	mounted() {},
	methods: {
		listUser() {
			//获取商铺列表
			let fn = new FormData()
			fn.append('sign_status', 30) //已合作的店铺
			fn.append('status', 1) //启用的店铺
			fn.append('city_id', this.city_id)
			fn.append('agent_id', this.agent_id)
			// fn.append("search_list", 1); //不进行分页
			this.$http.post(this.url + '/shop/getListForSearch', fn).then(
				res => {
					// console.log(res.data.data);
					if (res.data.msg == '查询成功' || res.data.code == '200') {
						if (res.data.data != null) {
							res.data.data.list.forEach(item => {
								item.value = item.name
							})
							this.shopList = res.data.data.list
						} else {
							this.shopList = []
						}
					} else if (res.data.code == '8886') {
						//code   8886  登录过期
						sessionStorage.clear()
						this.$alert('登录已过期，请重新登录 !', '提示', {
							confirmButtonText: '确定',
							callback: action => {
								window.location = 'login.html'
							}
						})
						return
					} else {
						this.$message.error(res.data.msg)
						return
					}
				},
				res => {
					this.$message.error('网络错误！')
					return
				}
			)
		},
		listShop() {
			let s_departmentIds_Arr = new Array()
			this.s_area_arr.forEach(element => {
				let [id, name] = element.split('|') // es6 数组解构赋值
				s_departmentIds_Arr.push(id.toString())
			})

			//获取订单列表
			let fn = new FormData()
			fn.append('pageSize', this.pageSizeNow) //每页多少条
			fn.append('page', this.pageNum) //页数
			fn.append('sn', this.adjustment_sn)
			fn.append('task_sn', this.task_sn)
			fn.append('city_id', this.city_id)
			fn.append('bill_sn', this.bill_sn)
			fn.append('area_id', '' + s_departmentIds_Arr)
			fn.append('agent_id', this.agent_id)
			fn.append('shop_name', this.shop_name)
			fn.append('staff_name', this.s_personnel_name)
			fn.append('adjust_type', this.adjust_type)
			fn.append('status', this.status)
			fn.append('start_time', this.start_time)
			fn.append('end_time', this.end_time)

			this.$http.post(this.url + '/billChange/getList', fn).then(
				res => {
					if (res.data.msg == '查询成功！' || res.data.code == '200') {
						if (res.data.data != null) {
							this.adjustmentList = res.data.data.list
							this.total = res.data.data.count
						} else {
							this.adjustmentList = []
							this.total = 0
						}
					} else if (res.data.code == '8886') {
						//code   8886  登录过期
						sessionStorage.clear()
						this.$alert('登录已过期，请重新登录 !', '提示', {
							confirmButtonText: '确定',
							callback: action => {
								window.location = 'login.html'
							}
						})
						return
					} else {
						this.$message.error(res.data.msg)
						return
					}
				},
				res => {
					this.$message.error('网络错误！')
					return
				}
			)
		},
		PersonnelList() {
			//获取人才列表
			let fn = new FormData()
			// 展示已认证过的人员姓名
			fn.append('certification_status', 1) //实名认证状态 [1]已认证 [2]未认证
			this.$http.post(this.url + '/user/getListForSearch', fn).then(
				res => {
					// console.log(res.data.data);
					if (res.data.msg == '查询成功' || res.data.code == '200') {
						if (res.data.data != null) {
							res.data.data.list.forEach(item => {
								item.value = item.name
							})
							this.renList = res.data.data.list
						} else {
							this.renList = []
						}
					} else if (res.data.code == '8886') {
						//code   8886  登录过期
						sessionStorage.clear()
						this.$alert('登录已过期，请重新登录 !', '提示', {
							confirmButtonText: '确定',
							callback: action => {
								window.location = 'login.html'
							}
						})
						return
					} else {
						this.$message.error(res.data.msg)
						return
					}
				},
				res => {
					this.$message.error('网络错误！')
					return
				}
			)
		},
		// 监听城市val变化
		changeCity() {
			let [id, name, city_sn] = this.city_val.split('|') // es6 数组解构赋值
			this.city_id = id
			this.city_name = name
			this.city_sn = city_sn

			this.shop_name = ''
			this.shop_id = ''
			this.shop_sn = ''
			this.fetchAreaList() //商圈列表
			this.listUser() //店铺列表
		},
		//获取商圈列表
		fetchAreaList() {
			this.s_area_arr = []
			let fn = new FormData()
			fn.append('city_id', this.city_id)
			fn.append('agent_id', this.agent_id)
			this.$http.post(this.url + '/area/list', fn).then(
				res => {
					if (res.data.msg == '查询成功' || res.data.code == '200') {
						if (res.data.data != null) {
							res.data.data.list.forEach(item => {
								item.value = item.area_name
							})
							this.areaList = res.data.data.list
							// if (this.s_area_arr == '' || this.s_area_arr == null) {
							// 	// 默认选中非254-平谷的
							// 	this.areaList.forEach(element => {
							// 		// 平谷
							// 		if (element.area_name != '平谷') {
							// 			var pusharr = element.id + '|' + element.area_name
							// 			this.s_area_arr.push(pusharr)
							// 		}
							// 	})
							// }
						} else {
							this.areaList = []
						}
					} else if (res.data.code == '8886') {
						//code   8886  登录过期
						sessionStorage.clear()
						this.$alert('登录已过期，请重新登录 !', '提示', {
							confirmButtonText: '确定',
							callback: action => {
								window.location = 'login.html'
							}
						})
						return
					} else {
						this.$message.error(res.data.msg)
						return
					}
				},
				res => {
					this.$message.error('网络错误！')
					return
				}
			)
		},
		shearchBtn() {
			// 搜索
			this.pageNum = 1
			this.listShop()
		},

		async resetBtn() {
			await this.resetData() //重置请求数据
		},

		resetData() {
			//重置请求数据
			this.pageNum = 1
			this.sn = ''
			this.adjustment_sn = ''
			this.task_sn = ''
			this.bill_sn = ''
			this.business_id = '' //所属商户ID
			this.business_name = '' //所属商户name
			this.shop_id = '' //店铺id
			this.shop_sn = '' //店铺sn
			this.shop_name = '' //店铺名
			this.adjust_type = '' //结算单类型
			this.status = '' //账号状态： 1:正常  2:禁用
			this.s_personnel_name = ''
			this.s_personnel_sn = ''
			this.reconciliation_type = ''
			this.agent_reset += 1
		},
		//店铺的自动完成
		querySearch(queryString, cb) {
			var restaurants = this.shopList
			var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
			// 调用 callback 返回建议列表的数据
			cb(results)
		},
		createFilter(queryString) {
			return restaurant => {
				return restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
			}
		},
		handleSelect(item) {
			this.shop_id = item.id
			this.shop_sn = item.shop_sn
		},
		//店铺的自动完成
		querySearchStaff(queryString, cb) {
			var restaurants = this.renList
			var results = queryString ? restaurants.filter(this.createFilterStaff(queryString)) : restaurants
			// 调用 callback 返回建议列表的数据
			cb(results)
		},
		createFilterStaff(queryString) {
			return restaurant => {
				return restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
			}
		},
		handleSelectStaff(item) {
			this.s_personnel_sn = item.staff_sn
		},
		//商户调账记录-导出
		downloadOrder() {
			let s_departmentIds_Arr = new Array()
			this.s_area_arr.forEach(element => {
				let [id, name] = element.split('|') // es6 数组解构赋值
				s_departmentIds_Arr.push(id.toString())
			})

			let obj = {
				token: JSON.parse(sessionStorage.getItem('manageInfo')).token,
				export: 1,
				city_id: this.city_id,
				sn: this.adjustment_sn,
				task_sn: this.task_sn,
				bill_sn: this.bill_sn,
				area_id: '' + s_departmentIds_Arr,
				agent_id: this.agent_id,
				shop_name: this.shop_name,
				shop_name: this.shop_name,
				staff_name: this.s_personnel_name,
				adjust_type: this.adjust_type,
				status: this.status,
				start_time: this.start_time,
				end_time: this.end_time
			}
			let param = $.param(obj)
			window.location.href = this.url + '/billChange/getList?' + param
		},
		//分页组件->子组件传值
		onChildValue(item) {
			this.pageNum = item[0]
			this.pageSizeNow = item[1]
			this.listShop()
		},
		changeBtndialogarea() {
			let [id, name] = this.area_arr.split('|') // es6 数组解构赋值
			this.area_id = id.toString()
			this.area_name = name.toString()
		},
		//修改
		rebegin(row) {
			//全局调账sn记录
			this.sn = row.sn
			this.JobStateedit = true
			//请求调账详情接口
			let fn = new FormData()
			fn.append('sn', row.sn)
			this.$http.post(this.url + '/billChange/getInfo', fn).then(
				res => {
					if (res.data.msg == '查询成功' || res.data.code == '200') {
						var task_info = res.data.data
						this.adjustment.adjustment_sn = task_info.sn //调账记录编号
						this.adjustment.task_sn = task_info.task_sn //任务编号
						this.adjustment.dpmc = task_info.shop_name //店铺名称
						this.adjustment.sq = task_info.area_name //商圈
						this.adjustment.gw = task_info.job_name //岗位
						this.adjustment.gzsj =
							task_info.task_info.start_time.substr(11, 5) + ' - ' + task_info.task_info.end_time.substr(11, 5) //工作时间
						this.adjustment.dj = task_info.task_info.amout_shop + '元/小时' //单价
						this.adjustment.personnel_dj = task_info.task_info.amout_staff + '元/小时' //单价
						this.adjustment.jdr = task_info.staff_name //接单人
						if (task_info.adjust_hours < 0) {
							this.adjustment.sc = '2' //时长状态
						} else {
							this.adjustment.sc = '1' //时长状态
						}
						this.adjustment.sc_next = Math.abs(task_info.adjust_hours) //时长
						this.adjustment.scje = task_info.amount_hours //时长金额
						if (task_info.amount_other < 0) {
							this.adjustment.qtje = '2' //其他金额状态
						} else {
							this.adjustment.qtje = '1' //其他金额状态
						}
						this.adjustment.qtje_next = Math.abs(task_info.amount_other) //其他金额
						this.adjustment.hjje = task_info.adjust_amount //合计金额

						this.adjustment.sjsc = task_info.task_info.hour_actual + 'h' //实际时长
						this.adjustment.fy = task_info.task_info.total_shop + '元' //费用
						this.adjustment.qdsj = task_info.task_info.checkin_time //签到时间
						this.adjustment.wcsj = task_info.task_info.finish_time //完成时间
						this.adjustment.zt = task_info.task_info.status_name //状态
						this.adjustment.bz = task_info.remark //备注
						this.adjustment.adjust_type = task_info.adjust_type //结算单类型
					} else if (res.data.code == '8886') {
						//code   8886  登录过期
						sessionStorage.clear()
						this.$alert('登录已过期，请重新登录 !', '提示', {
							confirmButtonText: '确定',
							callback: action => {
								window.location = 'login.html'
							}
						})
						return
					} else {
						this.$message.error(res.data.msg)
						return
					}
				},
				res => {
					this.$message.error('网络错误！')
					return
				}
			)
		},
		// 确认调账
		async confirmation(row) {
			try {
				await this.$confirm('确定要确认调账吗?', '提现确认', {
					confirmButtonText: '提交',
					cancelButtonText: '取消',
					type: 'warning'
				})
				await confirmChange({
					sn: row.sn
				})
				this.$message.success('确认调账成功')
				this.listShop()
			} catch (err) {
				console.log('err', err)
			}
		},
		//查看
		rebeginsee(row) {
			console.log(row)
			this.JobStatesee = true
			//请求调账详情接口
			let fn = new FormData()
			fn.append('sn', row.sn)
			this.$http.post(this.url + '/billChange/getInfo', fn).then(
				res => {
					if (res.data.msg == '查询成功' || res.data.code == '200') {
						var task_info = res.data.data
						this.adjustment.adjustment_sn = task_info.sn //调账记录编号
						this.adjustment.task_sn = task_info.task_sn //任务编号
						this.adjustment.dpmc = task_info.shop_name //店铺名称
						this.adjustment.sq = task_info.area_name //商圈
						this.adjustment.gw = task_info.job_name //岗位
						this.adjustment.gzsj =
							task_info.task_info.start_time.substr(11, 5) + ' - ' + task_info.task_info.end_time.substr(11, 5) //工作时间
						this.adjustment.dj = task_info.task_info.amout_shop + '元/小时' //单价
						this.adjustment.personnel_dj = task_info.task_info.amout_staff + '元/小时' //单价
						this.adjustment.jdr = task_info.staff_name //接单人
						if (task_info.adjust_hours < 0) {
							this.adjustment.sc = '2' //时长状态
						} else {
							this.adjustment.sc = '1' //时长状态
						}
						this.adjustment.sc_next = Math.abs(task_info.adjust_hours) //时长
						this.adjustment.scje = task_info.amount_hours //时长金额
						if (task_info.amount_other < 0) {
							this.adjustment.qtje = '2' //其他金额状态
						} else {
							this.adjustment.qtje = '1' //其他金额状态
						}
						this.adjustment.qtje_next = Math.abs(task_info.amount_other) //其他金额
						this.adjustment.hjje = task_info.adjust_amount //合计金额

						this.adjustment.sjsc = task_info.task_info.hour_actual + 'h' //实际时长
						this.adjustment.fy = task_info.task_info.total_shop + '元' //费用
						this.adjustment.qdsj = task_info.task_info.checkin_time //签到时间
						this.adjustment.wcsj = task_info.task_info.finish_time //完成时间
						this.adjustment.zt = task_info.task_info.status_name //状态
						this.adjustment.bz = task_info.remark //备注
						this.adjustment.adjust_type = task_info.adjust_type
						this.adjustment.invoice_status_name = task_info.invoice_status_name || row.invoice_status_name
					} else if (res.data.code == '8886') {
						//code   8886  登录过期
						sessionStorage.clear()
						this.$alert('登录已过期，请重新登录 !', '提示', {
							confirmButtonText: '确定',
							callback: action => {
								window.location = 'login.html'
							}
						})
						return
					} else {
						this.$message.error(res.data.msg)
						return
					}
				},
				res => {
					this.$message.error('网络错误！')
					return
				}
			)
		},
		//作废
		ZfStop(row) {
			this.sn = row.sn
			this.FPShowStop = true
		},
		//作废确认
		next() {
			//作废接口
			let fn = new FormData()
			fn.append('sn', this.sn)
			this.$http.post(this.url + '/billChange/invalid', fn).then(
				res => {
					if (res.data.msg == '查询成功' || res.data.code == '200') {
						this.$message.success(res.data.msg)
						this.hiddenRY()
						this.listShop()
					} else if (res.data.code == '8886') {
						//code   8886  登录过期
						sessionStorage.clear()
						this.$alert('登录已过期，请重新登录 !', '提示', {
							confirmButtonText: '确定',
							callback: action => {
								window.location = 'login.html'
							}
						})
						return
					} else {
						this.$message.error(res.data.msg)
						return
					}
				},
				res => {
					this.$message.error('网络错误！')
					return
				}
			)
		},
		// 操作记录
		goTorecord(row) {
			this.cordTicket = true
			this.top_bill_sn = row.bill_sn
			this.message = row //行数据
		},
		getTaskInfo() {
			if (this.adjustment.task_sn != '') {
				//请求任务详情
				let fn = new FormData()
				fn.append('sn', this.adjustment.task_sn)
				this.$http.post(this.url + '/task/info', fn).then(
					res => {
						if (res.data.msg == '查询成功' || res.data.code == '200') {
							var task_info = res.data.data
							this.adjustment.dpmc = task_info.shop_name //店铺名称
							this.adjustment.sq = task_info.area_name //商圈
							this.adjustment.gw = task_info.job_name //岗位
							this.adjustment.gzsj = task_info.start_time.substr(11, 5) + ' - ' + task_info.end_time.substr(11, 5) //工作时间
							this.adjustment.dj = task_info.amout_shop + '元/小时' //单价
							this.adjustment.jdr = task_info.staff_name //接单人
							this.adjustment.sjsc = task_info.hour_actual + 'h' //实际时长
							this.adjustment.fy = task_info.total_shop + '元' //费用
							this.adjustment.qdsj = task_info.checkin_time //签到时间
							this.adjustment.wcsj = task_info.finish_time //完成时间
							this.adjustment.zt = task_info.status_name //状态
						} else if (res.data.code == '8886') {
							//code   8886  登录过期
							sessionStorage.clear()
							this.$alert('登录已过期，请重新登录 !', '提示', {
								confirmButtonText: '确定',
								callback: action => {
									window.location = 'login.html'
								}
							})
							return
						} else {
							this.$message.error(res.data.msg)
							return
						}
					},
					res => {
						this.$message.error('网络错误！')
						return
					}
				)
			}
		},
		// 调账记录
		ticketMesaudit(e) {
			if (this.adjustment.task_sn == '') {
				this.$message.error('请填写任务编号！')
				return
			}
			if (this.adjustment.bz == '') {
				this.$message.error('请填写备注！')
				return
			}

			if (this.adjustment.hjje == '' || this.adjustment.hjje == 0) {
				this.$message.error('请设置调账金额！')
				return
			}

			let fn = new FormData()
			fn.append('task_sn', this.adjustment.task_sn)
			fn.append('hour', this.adjustment.sc == 1 ? this.adjustment.sc_next * 1 : this.adjustment.sc_next * -1) // 时长
			fn.append('hour_money', this.adjustment.scje) // 时长金额
			fn.append('sum_money', this.adjustment.hjje) // 合计金额
			fn.append(
				'other_money',
				this.adjustment.qtje == 1 ? this.adjustment.qtje_next * 1 : this.adjustment.qtje_next * -1
			) // 其他金额
			fn.append('remark', this.adjustment.bz)
			if (e == 2) {
				fn.append('force', 1)
			}
			this.$http.post(this.url + '/billChange/create', fn).then(
				res => {
					if (res.data.msg == '查询成功' || res.data.code == '200') {
						this.$message.success(res.data.msg)
						this.hiddenRY()
						this.listShop()
					} else if (res.data.code == '8886') {
						//code   8886  登录过期
						sessionStorage.clear()
						this.$alert('登录已过期，请重新登录 !', '提示', {
							confirmButtonText: '确定',
							callback: action => {
								window.location = 'login.html'
							}
						})
						return
					} else if (res.data.code == '601') {
						//强制确认的弹框出现
						this.AssignmentTips = true
						return
					} else {
						this.$message.error(res.data.msg)
						return
					}
				},
				res => {
					this.$message.error('网络错误！')
					return
				}
			)
		},
		// 调账记录修改
		async ticketMesauditEdit() {
			if (this.adjustment.bz == '') {
				this.$message.error('请填写备注！')
				return
			}

			if (this.adjustment.hjje == '' || this.adjustment.hjje == 0) {
				this.$message.error('请设置调账金额！')
				return
			}

			let ret = await this.$confirm('确定要修改此调账吗？', '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			})
			if (ret === 'cancel') return

			let fn = new FormData()
			fn.append('sn', this.sn)
			fn.append('adjust_hours', this.adjustment.sc == 1 ? this.adjustment.sc_next * 1 : this.adjustment.sc_next * -1) // 时长
			fn.append('amount_hours', this.adjustment.scje) // 时长金额
			fn.append('adjust_amount', this.adjustment.hjje) // 合计金额
			fn.append(
				'amount_other',
				this.adjustment.qtje == 1 ? this.adjustment.qtje_next * 1 : this.adjustment.qtje_next * -1
			) // 其他金额
			fn.append('remark', this.adjustment.bz)
			fn.append('adjust_type', this.adjustment.adjust_type)

			this.$http.post(this.url + '/billChange/setInfo', fn).then(
				res => {
					if (res.data.msg == '查询成功' || res.data.code == '200') {
						this.$message.success(res.data.msg)
						this.hiddenRY()
						this.listShop()
					} else if (res.data.code == '8886') {
						//code   8886  登录过期
						sessionStorage.clear()
						this.$alert('登录已过期，请重新登录 !', '提示', {
							confirmButtonText: '确定',
							callback: action => {
								window.location = 'login.html'
							}
						})
						return
					} else if (res.data.code == '601') {
						//强制确认的弹框出现
						this.AssignmentTips = true
						return
					} else {
						this.$message.error(res.data.msg)
						return
					}
				},
				res => {
					this.$message.error('网络错误！')
					return
				}
			)
		},
		hiddenRY() {
			// this.JobState = false
			this.JobStateedit = false
			this.JobStatesee = false
			this.FPShowStop = false
			this.cordTicket = false
			this.AssignmentTips = false
			this.adjustment = {
				adjustment_sn: '', //调账记录编号
				task_sn: '', //任务编号
				dpmc: '', //店铺名称
				sq: '', //商圈
				gw: '', //岗位
				gzsj: '', //工作时间
				dj: '', //单价
				personnel_dj: '',
				jdr: '', //接单人
				sjsc: '', //实际时长
				fy: '', //费用
				qdsj: '', //签到时间
				wcsj: '', //完成时间
				zt: '', //状态
				sc: '1', //时长
				sc_next: '0',
				scje: '0', //时长金额
				qtje: '1', //其他金额
				qtje_next: '0',
				hjje: '0', //合计金额
				bz: '', //备注
				amout_staff: '', //人才单价
				adjust_type: '' //调账对象
			}
		},
		changeBtndialog() {
			let [id, name] = this.city_arr.split('|')
			this.city_id = id.toString()
			this.city_name = name.toString()
		},
		goToMore(row) {
			const { href } = this.$router.resolve({
				path: '/orderTradeList',
				query: { logic_sn: row.order_record_sn.join(',') }
			})
			window.open(href, '_blank')
		},
		//全选-取消全选商圈
		selectAllArea() {
			let arr = []
			this.areaList.forEach(item => {
				arr.push(`${item.id}|${item.area_name}`)
			})
			if (this.areaStatus == true) {
				this.s_area_arr = arr
			} else {
				this.s_area_arr = []
			}
			this.areaStatus = !this.areaStatus
		},
		setValue(arrVal) {
			this.agent_id = arrVal.agent_id
			this.cityList = arrVal.city_list
			this.city_val = this.cityList[0].name
			this.city_id = this.cityList[0].id

			this.shop_name = ''
			this.shop_id = ''
			this.shop_sn = ''

			this.fetchAreaList() //商圈列表
			this.listUser() //店铺列表
		}
	},
	filters: {
		ReversalTime: function (value) {
			value = value % 24
			return common.getReversalTime(value)
		},
		dateshear: function (value) {
			value = value.substr(5, 5).trim()
			return value
		}
	}
}
</script>

<style scoped>
.auditCentent .labels {
	min-height: 100px;
}
.auditCentent .labels .labels_label {
	float: left;
	cursor: pointer;
}
.check_label {
	background: var(--purple4);
	color: #fff;
	border: none;
}
.pdf {
	width: 860px;
	height: 600px;
}
.main_user {
	background: var(--zfy-red);
	color: #fff;
	text-decoration: none;
	padding: 2px 4px;
	border-radius: 4px;
}

.auditCentent_next {
	display: flex;
	margin-bottom: 10px;
}

.timeline {
	height: 30px;
	line-height: 30px;
	margin-bottom: 20px;
}

.timeline span {
	margin-left: 10px;
}
</style>



// WEBPACK FOOTER //
// src/components/billshop/AdjustmentList.vue